#!/bin/sh

[ -e %OPTWARE_TARGET_PREFIX%/etc/default/dropbear ] && . %OPTWARE_TARGET_PREFIX%/etc/default/dropbear

if [ "$DROPBEAR_ENABLE" = "no" ]; then
    exit
fi

if [ -n "`pidof dropbear`" ]; then 
    killall dropbear 2>/dev/null
fi

if [ -n "$DROPBEAR_PORT" ]; then
    %OPTWARE_TARGET_PREFIX%/sbin/dropbear -p $DROPBEAR_PORT
else
    %OPTWARE_TARGET_PREFIX%/sbin/dropbear
fi
